(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

+(x, 0) → x
+(x, i(x)) → 0
+(+(x, y), z) → +(x, +(y, z))
*(x, +(y, z)) → +(*(x, y), *(x, z))
*(+(x, y), z) → +(*(x, z), *(y, z))

Rewrite Strategy: INNERMOST

(1) DependencyGraphProof (BOTH BOUNDS(ID, ID) transformation)

The following rules are not reachable from basic terms in the dependency graph and can be removed:
+(+(x, y), z) → +(x, +(y, z))
*(x, +(y, z)) → +(*(x, y), *(x, z))
*(+(x, y), z) → +(*(x, z), *(y, z))

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

+(x, i(x)) → 0
+(x, 0) → x

Rewrite Strategy: INNERMOST

(3) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(4) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

+(x, i(x)) → 0 [1]
+(x, 0) → x [1]

Rewrite Strategy: INNERMOST

(5) CpxWeightedTrsRenamingProof (BOTH BOUNDS(ID, ID) transformation)

Renamed defined symbols to avoid conflicts with arithmetic symbols:

+ => plus

(6) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

plus(x, i(x)) → 0 [1]
plus(x, 0) → x [1]

Rewrite Strategy: INNERMOST

(7) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(8) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

plus(x, i(x)) → 0 [1]
plus(x, 0) → x [1]

The TRS has the following type information:
plus :: i:0 → i:0 → i:0
i :: i:0 → i:0
0 :: i:0

Rewrite Strategy: INNERMOST

(9) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:

plus(v0, v1) → null_plus [0]

And the following fresh constants:

null_plus

(10) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

plus(x, i(x)) → 0 [1]
plus(x, 0) → x [1]
plus(v0, v1) → null_plus [0]

The TRS has the following type information:
plus :: i:0:null_plus → i:0:null_plus → i:0:null_plus
i :: i:0:null_plus → i:0:null_plus
0 :: i:0:null_plus
null_plus :: i:0:null_plus

Rewrite Strategy: INNERMOST

(11) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

0 => 0
null_plus => 0

(12) Obligation:

Complexity RNTS consisting of the following rules:

plus(z, z') -{ 1 }→ x :|: x >= 0, z = x, z' = 0
plus(z, z') -{ 1 }→ 0 :|: z' = 1 + x, x >= 0, z = x
plus(z, z') -{ 0 }→ 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1

Only complete derivations are relevant for the runtime complexity.

(13) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V, V1),0,[plus(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(plus(V, V1, Out),1,[],[Out = 0,V1 = 1 + V2,V2 >= 0,V = V2]).
eq(plus(V, V1, Out),1,[],[Out = V3,V3 >= 0,V = V3,V1 = 0]).
eq(plus(V, V1, Out),0,[],[Out = 0,V4 >= 0,V5 >= 0,V = V4,V1 = V5]).
input_output_vars(plus(V,V1,Out),[V,V1],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [plus/3]
1. non_recursive : [start/2]

#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into plus/3
1. SCC is partially evaluated into start/2

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations plus/3
* CE 3 is refined into CE [6]
* CE 5 is refined into CE [7]
* CE 4 is refined into CE [8]


### Cost equations --> "Loop" of plus/3
* CEs [6,7] --> Loop 4
* CEs [8] --> Loop 5

### Ranking functions of CR plus(V,V1,Out)

#### Partial ranking functions of CR plus(V,V1,Out)


### Specialization of cost equations start/2
* CE 2 is refined into CE [9,10]


### Cost equations --> "Loop" of start/2
* CEs [9,10] --> Loop 6

### Ranking functions of CR start(V,V1)

#### Partial ranking functions of CR start(V,V1)


Computing Bounds
=====================================

#### Cost of chains of plus(V,V1,Out):
* Chain [5]: 1
with precondition: [V1=0,V=Out,V>=0]

* Chain [4]: 1
with precondition: [Out=0,V>=0,V1>=0]


#### Cost of chains of start(V,V1):
* Chain [6]: 1
with precondition: [V>=0,V1>=0]


Closed-form bounds of start(V,V1):
-------------------------------------
* Chain [6] with precondition: [V>=0,V1>=0]
- Upper bound: 1
- Complexity: constant

### Maximum cost of start(V,V1): 1
Asymptotic class: constant
* Total analysis performed in 26 ms.

(14) BOUNDS(1, 1)